home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / info-service / www / src / WWW / Library / Implementation / HTRules.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-21  |  3.3 KB  |  135 lines

  1. /*                                                           Configuration Manager for libwww
  2.                                   CONFIGURATION MANAGER
  3.                                              
  4.    Author Tim Berners-Lee/CERN. Public domain. Please mail changes to timbl@info.cern.ch.
  5.    
  6.    The configuration information loaded includes tables (file suffixes, presentation
  7.    methods) in other modules.  The most likely routines needed by developers will be:
  8.    
  9.   HTSetConfiguration      to load configuration information.
  10.                          
  11.   HTLoadRules             to load a whole file of configuration information
  12.                          
  13.   HTTranslate             to translate a URL using the rule table.
  14.                          
  15.  */
  16. #ifndef HTRULE_H
  17. #define HTRULE_H
  18.  
  19. #include "HTUtils.h"
  20.  
  21. typedef enum _HTRuleOp {HT_Invalid, HT_Map, HT_Pass, HT_Fail} HTRuleOp;
  22.  
  23. /*
  24.  
  25. HTAddRule:  Add rule to the list
  26.  
  27.   ON ENTRY,
  28.   
  29.   pattern                points to 0-terminated string containing a single "*"
  30.                          
  31.   equiv                  points to the equivalent string with * for the place where the
  32.                          text matched by * goes.
  33.                          
  34.   ON EXIT,
  35.   
  36.   returns                0 if success, -1 if error.
  37.                          
  38.    Note that if BYTE_ADDRESSING is set, the three blocks required are allocated and
  39.    deallocated as one. This will save time and storage, when malloc's allocation units are
  40.    large.
  41.    
  42.  */
  43. extern int HTAddRule PARAMS((HTRuleOp op, const char * pattern, const char * equiv));
  44.  
  45.  
  46. /*
  47.  
  48. HTClearRules: Clear all rules
  49.  
  50.   ON EXIT,
  51.   
  52.   Rule file               There are no rules
  53.                          
  54.   returns
  55.                           0 if success, -1 if error.
  56.                          
  57.  */
  58.  
  59. #ifdef __STDC__
  60. extern int HTClearRules(void);
  61. #else
  62. extern int HTClearRules();
  63. #endif
  64.  
  65.  
  66. /*
  67.  
  68. HTTranslate: Translate by rules
  69.  
  70.  */
  71.         
  72. /*
  73.  
  74.   ON ENTRY,
  75.   
  76.   required                points to a string whose equivalent value is neeed
  77.                          
  78.   ON EXIT,
  79.   
  80.   returns                 the address of the equivalent string allocated from the heap
  81.                          which the CALLER MUST FREE. If no translation occured, then it is
  82.                          a copy of the original.
  83.                          
  84.  */
  85. #ifdef __STDC__
  86. extern char * HTTranslate(const char * required);
  87. #else
  88. extern char * HTTranslate();
  89. #endif
  90.  
  91.  
  92. /*
  93.  
  94. HTSetConfiguration:  Load one line of configuration information
  95.  
  96.   ON ENTRY,
  97.   
  98.   config                  is a string in the syntax of a rule file line.
  99.                          
  100.    This routine may be used for loading configuration information from sources other than
  101.    the  rule file, for example INI files for X resources.
  102.    
  103.  */
  104. extern int HTSetConfiguration PARAMS((CONST char * config));
  105.  
  106.  
  107. /*
  108.  
  109. HtLoadRules:  Load the rules from a file
  110.  
  111.   ON ENTRY,
  112.   
  113.   Rule table              Rules can be in any state
  114.                          
  115.   ON EXIT,
  116.   
  117.   Rule table              Any existing rules will have been kept. Any new rules will have
  118.                          been loaded on top, so as to be tried first.
  119.                          
  120.   Returns                 0 if no error.
  121.                          
  122.  */
  123.  
  124. #ifdef __STDC__
  125. extern int HTLoadRules(const char * filename);
  126. #else
  127. extern int HTLoadRules();
  128. #endif
  129.  
  130.  
  131. #endif /* HTUtils.h */
  132. /*
  133.  
  134.    end  */
  135.